var txt,shijian,project,numb;
var fengzi = $('#page a b').first();
var fengmu = $('#page a b').last();
project = $('h1').attr("project");
query(1,project);
num(project);
//首页
    function first(){
        query(1,project);
        fengzi.text("1");
    }
//上一页    
    function previous(){
        var zi= parseInt(fengzi.text());
        var mu = parseInt(fengmu.text());
        if(zi>1){
        zi= zi-1;
        fengzi.text(zi);
        query(zi,project);
        }
    }
//下一页    
    function next(){
        var zi= parseInt(fengzi.text());
        var mu = parseInt(fengmu.text());
        if(zi<mu){
        zi= zi+1;
        fengzi.text(zi);
        query(zi,project);
        }
    }
//尾页    
    function last(){
        query(fengmu.text(),project);
        fengzi.text(fengmu.text());
    }
//跳转
  function jump(){
   var jump = $('[name=jump]').val();
   var mu = parseInt(fengmu.text());
   if(1<=jump&&jump<=mu){
        fengzi.text(jump);
        query(jump,project);
   }
  }    
function query (page,project){
    $('#tbody').empty();
    txt="";
    new Ajax("/my/my_source_query.jsp").keyvalue({"page":page,"project":project}).getJson(function(json){
        $.each(json,function(key,val){
          shijian = new Date(val["shijian"]*1000).toString().substring(0,16);
          txt+="<tr><td>"+val["corpname"]+"</td><td>"+val["linkname"]+"</td><td>"+val["phone"]+"</td><td>"+shijian+"</td></tr>";       
        })
        $('#tbody').html(txt);
    })
};
function num(progect1){
    new Ajax("/my/my_source_page.jsp").keyvalue("project",progect1).get(function(json){
       numb = Math.ceil(json.replace(/[^0-9]/ig, "")/10);
       fengmu.text(numb);
    })
       fengzi.text("1");
}
